package cn.tedu.charging.device.canal;

import cn.tedu.charging.device.pojo.po.ChargingStationCanalPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;

@Slf4j
@Component
@CanalTable("charging_station")
public class StationSyncHandler implements EntryHandler<ChargingStationCanalPO> {

    @Autowired
    private RedisTemplate redisTemplate;


    @Override
    public void delete(ChargingStationCanalPO stationCanalPO) {
        log.debug("canal-delete:{}",stationCanalPO);
        EntryHandler.super.delete(stationCanalPO);
    }

    @Override
    public void insert(ChargingStationCanalPO stationCanalPO) {
        log.debug("canal-delete:{}",stationCanalPO);
        EntryHandler.super.insert(stationCanalPO);
    }


    @Override
    public void update(ChargingStationCanalPO beforeStationCanalPO, ChargingStationCanalPO afterStationCanalPO ) {
        log.debug("canal-update after:{},before:{}",afterStationCanalPO,beforeStationCanalPO);
        EntryHandler.super.update(beforeStationCanalPO, afterStationCanalPO);
    }
}
